import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import nodePolyfills from 'rollup-plugin-node-polyfills';
import babel from 'rollup-plugin-babel';
import json from '@rollup/plugin-json';

export default {
  input: 'src/main.js',
  output: {
    file: 'dist/mind-map.js',
    format: 'cjs',
  },
  plugins: [
    nodePolyfills({
      browser: true,
      preferBuiltins: true,
	    mainFields: ['browser']
    }),
    resolve(),
    babel({
      exclude: 'node_modules/**', // 只编译我们的源代码
      runtimeHelpers: true, // 配置runtime，不设置会报错
    }),
    commonjs({
      namedExports: {'tslib': ['__awaiter', '__generator']}
    }), // 这样 Rollup 能转换 `ms` 为一个ES模块
		// eslint(),
		// babel(),
		// terser(),
    json()
  ]
}